package com.atguigu.day16.date;

import org.junit.Test;

import java.util.Date;

/*
Date:
    new Date(); 执行一刹那的时间
    new Date(毫秒值): 指定毫秒值的日期对象
    date.getTime(); 日期对象的毫秒值
 */
public class DateTest {
    @Test
    public void test01() {

        Date date = new Date();
        System.out.println("date = " + date);//Tue Nov 19 16:07:23 CST 2024
        //124
        System.out.println("date.getYear() = " + date.getYear());
        //10
        System.out.println("date.getMonth() = " + date.getMonth());
    }

    @Test
    public void test02() {
        Date date = new Date();
        long time = date.getTime();
        System.out.println("time = " + time);// 1732003799589
    }

    @Test
    public void test03(){
        Date date = new Date(1732003799589L);
        System.out.println("date = " + date);
    }
}
